import React, { Component } from 'react'
import { Switch, Route, Redirect } from "react-router-dom"
import Home from "../views/home"
import About from "../views/about"
import MyNavLink from "../components/MyNavLink"

export default class app extends Component {
    render() {
        return (
            <div>
                <div><h2>Router</h2></div>
                <div>
                    <div>
                        <button>
                            <MyNavLink to='/about'>About</MyNavLink>
                        </button><br></br>
                        <button>
                            <MyNavLink to='/home'>Home</MyNavLink>
                        </button>
                    </div>
                </div>
                <div>
                    <Switch>
                        <Route path="/about" component={About} />
                        <Route path="/home" component={Home} />
                        <Redirect to="/home" />
                    </Switch>

                </div>
            </div>
        )
    }
}
